﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using DeviceManager.DataAccessLayer;
using DeviceManager.BusinessLogicLayer;
using DeviceManagementIT.DevicesManager.Unit;

namespace DeviceManagementIT.DevicesManager.DevicesManagement
{
    public partial class frmEditQuiqment : DevExpress.XtraEditors.XtraForm
    {
        DeviceBllOperation devicebll = new DeviceBllOperation();
        THIETBI device;
        public frmEditQuiqment()
        {
            InitializeComponent();
        }

        private void btnUpadte_Click(object sender, EventArgs e)
        {
            device = new THIETBI();
            device.MaThietBi = txtMaTB.Text;
            device.TenThietBi = txtTenTb.Text;
            device.SoHieu = txtSoHieu.Text;
            device.LOAITHIETBI.LoaiTBID = int.Parse(txtLoaiTB.Text);
            device.DONVITINH.DVTIT = int.Parse(cbbDVT.Text);
            device.NUOC.NuocID = int.Parse(cbbNuocSX.Text);
            device.HanBaoHanh = short.Parse(cbbBaoHanh.Text);
            device.NamSX = int.Parse(cbbNamSX.Text);
            device.ThongSoKT = mmeTSKT.Text;
            device.MoTaThem = mmeMoTa.Text;
            device.TaiLieuKT = txtPath.Text;
            string message = devicebll.UpdateRecordDevice(device);
            MessageBox.Show(message, "Message");
        }

        private void x_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void btnAddDVT_Click(object sender, EventArgs e)
        {
            frmAddUnit m_frmAddUnit = new frmAddUnit();
            m_frmAddUnit.Show();
        }

        private void btnAddNuocSX_Click(object sender, EventArgs e)
        {
            frmNuocSX m_frmNuocSX = new frmNuocSX();
            m_frmNuocSX.Show();
        }
    }
}